package com.example.bean;

import lombok.Data;

import java.io.Serializable;
import java.util.Date;

@Data
public class Event implements Serializable{

    int eventsId;
    String eventStatus;
    String eventsName;
    String refereeInfo;
    String equipments;
    String venues;
    Date startTime;
    Date endTime;

    //获取赛事状态
    public String getEventStatus() {
        Date curTime = new Date();
        if(curTime.before(startTime)) {
            return "报名中";
        } else if (curTime.before(endTime) && curTime.after(startTime)) {
            return "进行中";
        } else if(curTime.after(endTime)) {
            return "已结束";
        }
        return "???";
    }
}
